package com.zhai.domain.task.service;

import com.zhai.domain.task.model.entity.TaskEntity;
import com.zhai.domain.task.repository.ITaskRepository;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.Collections;
import java.util.List;

/**
 * @Description: 消息任务处理
 * @ClassName: TaskService
 * @Author: zhaiyongxin
 * @Date: 2025/3/5 21:18
 * @Version: 1.0
 */
@Service
@Slf4j
public class TaskService implements ITaskService {
    @Resource
    private ITaskRepository taskRepository;
    /**
     * 查询未发送消息的任务列表
     *
     * @return
     */
    @Override
    public List<TaskEntity> queryNoSendMessageTaskList() {
        return taskRepository.queryNoSendMessageTaskList();
    }

    @Override
    public void updateTaskSendMessageCompleted(String userId, String messageId) {
        taskRepository.updateTaskSendMessageCompleted(userId, messageId);
    }

    @Override
    public void updateTaskSendMessageFail(String userId, String messageId) {
        taskRepository.updateTaskSendMessageFail(userId, messageId);
    }

    @Override
    public void sendMessage(TaskEntity taskEntity) {
        taskRepository.sendMessage(taskEntity);
    }
}
